<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.model.Fault" %>
<%@ page import="com.control.FaultControl" %>
<%@ page import="com.util.PageResultSet"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>学生查看报修信息</title>
	</head>
	<body>
	<%
		request.setCharacterEncoding("UTF-8");
		FaultControl fc = new FaultControl();
		ArrayList<Fault> list = new ArrayList<Fault>();
		list = fc.getAllFault();
	 %>
		<fieldset>
			<legend>
				查看报修信息
			</legend>
			<table align="center">
				<tr>
					<td height="10">
					</td>
				</tr>
				
				<% 
					String ToolBar = "";
	    			int curPage = 1;
	    			if(request.getParameter("cur_page")!= null) {
						curPage = Integer.parseInt(request.getParameter("cur_page")); 
					}
					PageResultSet p = new PageResultSet(list,curPage,3);
					ArrayList<Fault> nowlist = new ArrayList<Fault>();
					nowlist = (ArrayList<Fault>)p.getData();
					String fileName = "faultInfo_show.jsp";
					ToolBar = p.getToolBar(fileName);
					for(int i=0; i<nowlist.size(); i++) {
						Fault fault = nowlist.get(i);
				%>
				<tr>
					<td>
						<table width="80%" border="1" align="center" cellpadding="0"
							cellspacing="0">
							<tr>
								<td width="200" height="30" align="left" bgcolor="#FFFFFF">
									<span>报修人：<%=fault.getStu_name() %></span>
								</td>
								<td width="200" align="center" bgcolor="#FFFFFF">
									<span>报修类型：<%=fault.getFault_type() %></span>
								</td>
								<td width="290" align="center" bgcolor="#FFFFFF">
									<span>报修时间：<%=fault.getFault_time() %></span>
								</td>
								<td width="290" align="center" bgcolor="#FFFFFF">
								<%if(fault.getFault_deal()==true){ %>
									<span style="color: red">已处理</span>
								<%}
								else{
								 %>
								 	<span>未处理</span>
								 <%} %>
								</td>
							</tr>
							<tr>
								<td height="30" colspan="4" align="left" bgcolor="#FFFFFF">
									<span>报修地址：<%=fault.getBuilding_name() %>-<%=fault.getDorm_name() %></span>
								</td>
							</tr>
							<tr>
								<td height="30" colspan="4" align="left" bgcolor="#FFFFFF">
									<span>故障描述：<%=fault.getFault_des() %></span>
								</td>
								
							</tr>
							<tr>
								
								<%if(fault.getFault_deal()==true){ %>
									<td colspan="3" height="30" align="left" bgcolor="#FFFFFF">
										<span style="color: red">管理员回复：<%=fault.getFault_reply()%></span>
									</td>
									<td width="290" align="center" bgcolor="#FFFFFF">
										<span style="color: red">回复时间：<%=fault.getServe_time()%></span>
									</td>
								<%}else { %>
									<td height="30" colspan="4" align="left" bgcolor="#FFFFFF">
										<span>管理员回复：<%=fault.getFault_reply()%> </span>
									</td>
								<%} %>
								
							</tr>
						</table>
					</td>
				</tr>
				<%} %>
				<tr>
					<td height="10">
					</td>
				</tr>
			</table>
			<%=ToolBar %>
		</fieldset>
	</body>
</html>